def generate_prime_list(ending: int):
    if ending < 2:
        return []

    result = []
    for current in range(3, ending + 1, 2):
        sqr = (current ** 1 / 2).__ceil__()
        for divisor in result:
            if divisor > sqr:
                result.append(current)
                break
            if current % divisor == 0:
                break
        else:
            result.append(current)

    result.insert(0, 2)
    return result
